package com.lxy.demo.controller;


import com.lxy.demo.entity.Type;
import com.lxy.demo.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Component
@RequestMapping("/type")
public class TypeController {

    @Autowired
    private TypeService typeService;

    @RequestMapping("/find")
    public String findType(HttpServletRequest request) {
        List<Type> type = typeService.findType();
        request.getSession().setAttribute("type", type);
        return "forward:/book/main";
    }
}